﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% Option Explicit %>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
<META NAME="copyright" CONTENT="Copyright 2009-2010 - Martechina Co.Ltd" />
<META NAME="Author" CONTENT="劢格机械(中国)  Www.Martechina.Com" />
<META NAME="Keywords" CONTENT="" />
<META NAME="Description" CONTENT="" />
<TITLE>编辑导航</TITLE>
<link href="css.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../inc/Admin.js"></script>
</HEAD>
<!--#include file="../inc/Const.asp" -->
<!--#include file="../inc/ConnSiteData.asp" -->
<!--#include file="CheckAdmin.asp"-->
<%
'cookie 验证
'if Instr(request.cookies("Martech_com")("AdminPurview"),"|4,")=0 then 
'  response.write ("<font color='red')>你不具有该管理模块的操作权限，请返回！</font>")
'  response.end
'end if

'session 验证
if Instr(session("AdminPurview"),"|4,")=0 then 
  response.write ("<font color='red')>你不具有该管理模块的操作权限，请返回！</font>")
  response.end
end if
'========判断是否具有管理权限
%>
<BODY>
<% 
dim Result
Result=request.QueryString("Result")
dim ID,Name,eName,ViewFlag,eViewFlag,Url,eUrl,OutFlag,Remark
ID=request.QueryString("ID")
call NavEdit() 
%>
<table border="0" cellspacing="1" cellpadding="0" height="0" align="center" width="100%" >
  <tr>
  <td>
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr class="classtop">
    <td height="24" align="center" nowrap ><a href="NavigationEdit.asp?Result=Add" onClick='changeAdminFlag("添加导航栏目")'>添加导航栏目</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="NavigationList.asp" onClick='changeAdminFlag("导航栏目列表")'>查看导航栏目</a></td>
  </tr>
</table>
<br>
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <form name="editForm" method="post" action="NavigationEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
  <tr>
 <td height="27" colspan="4" align="center" class="classtop"><strong>增加导航</strong></td>
</tr>
      <tr class=classtd>
        <td  height="20" align="right">导航名称：(中文)</td>
        <td ><input name="Name" type="text" class="textfield" id="Name" style="WIDTH: 240;" value="<%=Name%>" maxlength="100">&nbsp;发布：<input name="ViewFlag" type="checkbox" style='HEIGHT: 13px;WIDTH: 13px;' value="1" checked <%if ViewFlag then response.write ("checked")%>>
&nbsp;*&nbsp;不少于2个字符</td>
      </tr>
      <tr class=classtd>
        <td  height="20" align="right">导航名称：(英文)</td>
        <td ><input name="eName" type="text" class="textfield" id="eName" style="WIDTH: 240;" value="<%=eName%>" maxlength="100">&nbsp;发布：<input name="eViewFlag" type="checkbox" style='HEIGHT: 13px;WIDTH: 13px;' value="1" checked <%if eViewFlag then response.write ("checked")%>>
&nbsp;*&nbsp;不少于2个字符</td>
      </tr>
     <tr class=classtd>
        <td  height="20" align="right">链接网址：(中文)</td>
        <td ><input name="Url" type="text" class="textfield" id="Url" style="WIDTH: 480;" value="<%=Url%>">&nbsp;*</td>
      </tr>
     <tr class=classtd>
        <td  height="20" align="right">链接网址：(英文)</td>
        <td ><input name="eUrl" type="text" class="textfield" id="eUrl" style="WIDTH: 480;" value="<%=eUrl%>">&nbsp;*</td>
      </tr>
     <tr class=classtd>
        <td  height="20" align="right">状　　态：</td>
        <td ><input name="OutFlag" type="checkbox" style='HEIGHT: 13px;WIDTH: 13px;' value="1" <%if OutFlag then response.write ("checked")%>>&nbsp;外链</td>
      </tr>
      <tr class=classtd>
        <td  height="20" align="right" valign="top">备注说明：
        <td ><textarea name="Remark" rows="6" class="textfield" id="Remark" style="WIDTH: 480;"><%=Remark%></textarea></td>
      </tr>

     <tr class=classtd>
        <td  height="30" align="right">&nbsp;</td>
        <td  valign="bottom"><input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 80;" ></td>
      </tr>
  </form>
</table>
</td>
</tr>
</table>
</BODY>
</HTML>
<%
sub NavEdit()
  dim Action,rsCheckAdd,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then '保存编辑信息
    set rs = server.createobject("adodb.recordset")
    if len(trim(request.Form("Name")))<2 then
      response.write ("<script language=javascript> alert('中文导航名称为必填项目，且不得少于2个字符！');history.back(-1);</script>")
      response.end
    end if
    if len(trim(request.Form("eName")))<2 then
      response.write ("<script language=javascript> alert('英文导航名称为必填项目，且不得少于2个字符！');history.back(-1);</script>")
      response.end
    end if
    if Result="Add" then '创建
	  sql="select * from Martech_Navigation"
      rs.open sql,conn,1,3
      rs.addnew
      rs("Name")=trim(Request.Form("Name"))
      rs("eName")=trim(Request.Form("eName"))
      rs("Url")=trim(Request.Form("Url"))
      rs("eUrl")=trim(Request.Form("eUrl"))
	  if Request.Form("ViewFlag")=1 then
        rs("ViewFlag")=Request.Form("ViewFlag")
	  else
        rs("ViewFlag")=0
	  end if
	  if Request.Form("eViewFlag")=1 then
        rs("eViewFlag")=Request.Form("eViewFlag")
	  else
        rs("eViewFlag")=0
	  end if
	  if Request.Form("OutFlag")=1 then
        rs("OutFlag")=Request.Form("OutFlag")
	  else
        rs("OutFlag")=0
	  end if
	  rs("Remark")=trim(Request.Form("Remark"))
	  rs("Sequence")=99
	  rs("AddTime")=now()
	end if  
	if Result="Modify" then '修改网站管理员
      sql="select * from Martech_Navigation where ID="&ID
      rs.open sql,conn,1,3
      rs("Name")=trim(Request.Form("Name"))
      rs("eName")=trim(Request.Form("eName"))
      rs("Url")=trim(Request.Form("Url"))
      rs("eUrl")=trim(Request.Form("eUrl"))
	  if Request.Form("ViewFlag")=1 then
        rs("ViewFlag")=Request.Form("ViewFlag")
	  else
        rs("ViewFlag")=0
	  end if
	  if Request.Form("eViewFlag")=1 then
        rs("eViewFlag")=Request.Form("eViewFlag")
	  else
        rs("eViewFlag")=0
	  end if
	  if Request.Form("OutFlag")=1 then
        rs("OutFlag")=Request.Form("OutFlag")
	  else
        rs("OutFlag")=0
	  end if
	  rs("Remark")=trim(Request.Form("Remark"))
	end if
	rs.update
	rs.close
    set rs=nothing 
    response.write "<script language=javascript> alert('成功编辑导航栏目！');changeAdminFlag('导航栏目列表');location.replace('NavigationList.asp');</script>"
  else '提取管理员信息
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from Martech_Navigation where ID="& ID
      rs.open sql,conn,1,1
	  Name=rs("Name")
	  eName=rs("eName")
	  ViewFlag=rs("ViewFlag")
	  eViewFlag=rs("eViewFlag")
      Remark=rs("Remark")
	  OutFlag=rs("OutFlag")
      Url=rs("Url")
      eUrl=rs("eUrl")
	  rs.close
      set rs=nothing 
	end if
  end if
end sub
%>